
const config = require('../config/index')
const mongoose = require('mongoose')

// 建立数据库连接
mongoose.connect(config.db.url)
const db = mongoose.connection

db.on('error', err => {
    console.log('数据库连接失败', err)
})


db.on('open', () => {
    console.log('数据库连接成功');
})
